package com.sun.designpatternsdemo.decorator

/**
 * 版权：xx公司 版权所有
 * @author sun
 * 版本：1.0
 * 创建日期：2021/6/30 11:04
 * 描述：类
 * 装备的接口
 * 下面有:武器,护腕,鞋子,戒指、、、、还有装饰品接口
 */
interface IEquip {
    //计算攻击力
    fun caculateAttack(): Int

    //装备的描述
    fun description(): String
}

interface IEuipDecorator : IEquip {

}

class BlueGemDecorator(val iEquip: IEquip) : IEuipDecorator {
    override fun caculateAttack(): Int {
        return 5 + iEquip.caculateAttack()
    }

    override fun description(): String {
        return iEquip.description() + "蓝宝石"
    }
}

class RedGemDecorator(val iEquip: IEquip) : IEuipDecorator {
    override fun caculateAttack(): Int {
        return 15 + iEquip.caculateAttack()
    }

    override fun description(): String {
        return iEquip.description() + "红宝石"
    }

}

class YellowGemDecorator(val iEquip: IEquip) : IEuipDecorator {
    override fun caculateAttack(): Int {
        return 10 + iEquip.caculateAttack()
    }

    override fun description(): String {
        return iEquip.description() + "黄宝石"
    }

}

class ArmEquip : IEquip {
    override fun caculateAttack(): Int = 20

    override fun description(): String = "屠龙宝刀"
}

class RingEquip : IEquip {
    override fun caculateAttack(): Int = 5

    override fun description(): String = "圣战戒指"
}

class ShoeEquip : IEquip {
    override fun caculateAttack(): Int = 5

    override fun description(): String = "圣战靴子"
}
class WristEquip : IEquip {
    override fun caculateAttack(): Int = 5

    override fun description(): String = "圣战护腕"
}
